﻿using System.Data.Entity;
using pbvs.Models;
using System.Linq;

namespace pbvs.Data.Repositories.RepositoryExtensions
{
    public static class ValuationRequestExtensions
    {
        public static IQueryable<ValuationRequest> ById(this IQueryable<ValuationRequest> query, int? id)
        {
            if (id.HasValue)
            {
                query = from q in query where q.Id == id.Value select q;
            }
            return query;
        }

	    public static IQueryable<ValuationRequest> RequireClient(this IQueryable<ValuationRequest> query)
	    {
		    return query.Include("Client");
	    }
    }
}